import request from "@/utils/request";

export function postArticle(data) {
  let creationTime = Date.now();
  return request({
    url: `/api/article/add`,
    method: 'post',
    data: {
      ...data,
      creationTime
    }
  })
}

export function getArticleList(society_id, pageNo, limit) {
  return request({
    url: '/api/article/info',
    method: 'get',
    params: {society_id, pageNo, limit}
  })
}

// 查看文章详细
export function delArticle(ids) {
  return request({
    url: '/api/article/del',
    method: 'post',
    data: {ids}
  })
}

// 更新文章
export function updateArticleDetail(id, detail) {
  return request({
    url: '/api/article/update',
    method: 'post',
    data: {id, detail}
  })
}

// 获取文章所有评论信息
export function getAllArticleComment(data) {
  return request({
    url:'/api/comment/get/all/article',
    method:'get',
    params:data
  })
}

export function deleteComment(comment) {
  return request({
    url:'/api/comment/del',
    method:'post',
    data:{comment}
  })
}